VC++中1<<bi.biBitCount是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/06/15 23:38:56
是左移一位吗?经常看到nColors=(1<<bi.biBitCount);为什么要左移呢?

可能就是吧,如:假如有256色的颜色索引(1-256)
nColors = 00000001;
nColors = (1<<3)
= 00001000
即:
nColors = 8;
现在颜色是索引中8的颜色。
当然它也可以是RGB颜色。如:
r = 1<<rb;
g = 1<<gb;
b = 1<<bb;
Colors = RGB(r, g, b);